<template>
<div>
    <el-tabs>
        <el-tab-pane disabled>
            <div slot="label">
                <el-select v-model="workType" placeholder="请选择工种" style="width:83%">
                    <el-option
                            v-for="item in workTypes"
                            :key="item.studyWorkerTypeId"
                            :label="item.name"
                            :value="item.studyWorkerTypeId">
                    </el-option>
                </el-select>
            </div>
        </el-tab-pane>
        <el-tab-pane label="试题管理">
            <test :workType="workType"/>
        </el-tab-pane>
        <el-tab-pane label="试卷管理">
            <visual :workType="workType"/>
        </el-tab-pane>
        <el-tab-pane label="资料管理">
            <readed :workType="workType"/>
        </el-tab-pane>
    </el-tabs>
</div>
</template>

<script> 
import readed from './template/readed'
import test from './template/test'
import visual from './template/visual'
import * as workTypeApi from '@/api/studyworktype'
export default {
  name: 'Index',
  components: {readed, test, visual},
  data() {
      return {
          workType: undefined,
          workTypes:[]
      }
  },
  methods:{
       //获取所有工种
        getAllStudyWorkerTypeList(){
            workTypeApi.getAllStudyWorkerTypeList({}).then(res =>{
                this.workTypes=res.data;
            })
        }
  },
  created(){
      this.getAllStudyWorkerTypeList();
  }
}
</script>

<style scoped>

</style>
